/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.hnilica.cisteniulic.bean;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import net.hnilica.cisteniulic.dao.UliceDAO;
import net.hnilica.cisteniulic.dto.Ulice;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;

/**
 *
 * @author swosh
 */
public class PartMunOfOneMun {
    private static final String defaultMunicipality = "PRAHA";

    public String getPartMunOfOneMun(){
        String municipality = defaultMunicipality;
        UliceDAO uliceDAO = new UliceDAO();

        Collection<Ulice> collUlice = uliceDAO.getPartMunOfOneMun(municipality);
        Collection<String> listSb = new ArrayList<String>();
        StringBuffer sb = new StringBuffer();
        sb.append("<td>");
        sb.append("<ul class='sprava_seznam'>");
        sb.append("<li class='sprava_seznam'>");
        sb.append("<h3>");
        sb.append(municipality);
        sb.append("</h3>");
        sb.append("</li>");


        for (Iterator<Ulice> it = collUlice.iterator(); it.hasNext();) {
            Ulice ulice = it.next();
            sb.append("<li class='black_border'><form action='municipality' name='part_municipality' method='post'>");
            sb.append("<input name='part_municipality' type='hidden' value=\"");
            sb.append(ulice.getNazCastiObce());
            sb.append("\"/>");
            sb.append("<input name='ok' class='white_background' type='submit' value=\"");
            sb.append(ulice.getNazCastiObce().replaceFirst(" ", "&#160;"));
            sb.append("\"/></form>");
            sb.append("</li>");
        }

        sb.append("</ul></td>");
        return sb.toString();

    }
    
}
